from visual import *
from visual.graph import * # import graphing features 
import serial
ser = serial.Serial('/dev/ttyUSB0', 115200)
t=0
GRAPH_VALUES = 40
scene=gdisplay()
#b=box()
cu=[gcurve(color=color.cyan),gcurve(color=color.green),gcurve(color=color.red),gcurve(color=color.blue),gcurve(color=color.yellow),gcurve(color=color.white)]
l=ser.readline().split('\t')
primo=map(int,l[:-1])
l=ser.readline().split('\t')
primo=map(int,l[:-1])
print primo
mmm=min(primo)
while True:
	l=ser.readline().split('\t')
	values=map(int,l[:-1])
	
	#print values
	rate(50)
	#b.rotate(angle=values[0]-mmm, axis=(10,0,0), origin=(0,0,0))
	#b.rotate(angle=values[1]-mmm, axis=(0,10,0), origin=(0,0,0))
	#b.rotate(angle=values[2]-mmm, axis=(0,0,10), origin=(0,0,0))
	ind=0
	for ag in values:
        	(cu[ind]).plot(pos=(t,ag-mmm))
		ind+=1
	#test1.plot(indicerandom,(t,ry))
	t += 0.1		
	scene.center=(t,0,0)
	'''if t>=10:
		scene.visble=False
		del scene
		scene=gdisplay()
	#print scene.mouse.project(normal=(0,0,1)) '''
